Working With Pictures
The Image Compression Manager provides a set of functions that allow applications to work easily with compressed pictures stored in version 2 PICT files. These functions constitute a high-level interface to image compression and decompression. Applications that require little control over the compression process may use these functions to display pictures that contain compressed image data.Existing programs can display (without changes) pictures that contain compressed image data. When the Image Compression Manager is installed on a system, it installs a new
StdPix
graphics function (see page 3-141 for more information on theStdPix
graphics function). This function handles all requests to display compressed images. Whenever an application issues the standard QuickDrawDrawPicture
routine (described in Inside Macintosh: Imaging) to display an image that contains compressed image data, theStdPix
function decompresses the image by invoking the Image Compression Manager. The function then delivers the decompressed image to the application.The Image Compression Manager also provides a simple mechanism for creating a picture that contains compressed image data. For example, to place an existing compressed image into a picture, your application could open the picture with QuickDraw's
OpenPicture
(orOpenCPicture
) function and then call the Image Compression Manager'sDecompressImage
function, as if you were going to display the image. The Image Compression Manager places the compressed image and the other data that describe the image into the picture for you.The Image Compression Manager stores the following information about a compressed picture:
The Image Compression Manager stores this information in the picture as a new PICT opcode (described in the following paragraphs). When an application draws the compressed picture on a Macintosh computer that is running the Image Compression Manager, the
- the image description, which describes the compression format and characteristics of the compressed image data
- the compressed data for the image
- the transfer mode (source copy mode, dither copy mode, and so on)
- the matte pixel map
- the mask region
- the mapping matrix
- the source rectangle of the image
StdPix
function instructs the Image Compression Manager to decompress the image. If an application tries to read a picture file that contains compressed data on a Macintosh that does not have the Image Compression Manager installed, the system ignores the new opcodes and displays a message that indicates that the user
needs QuickTime in order to display the compressed image data. The message states "QuickTime™ and a <Codec Name> decompressor are needed to see this picture". The Color QuickDraw version 2 picture format includes PICT opcodes for compressed and uncompressed QuickTime images. (An opcode is a hexidecimal number that represents drawing commands and the parameters that affect those drawing commands in a picture.) For more information on the version 2 picture format, see the chapter "Color QuickDraw" in Inside Macintosh: Imaging.
The PICT opcodes for compressed and uncompressed QuickTime images are
Table 3-1 gives an overview of the opcode for QuickTime compressed pictures.
- opcode $8200, which signals a compressed QuickTime image
- opcode $8201, which signals an uncompressed QuickTime image
The
- WARNING
- Do not attempt to read opcodes directly. For compatibility reasons, use Toolbox routines to access this information.
![]()
MaskSize
field of opcode $8200 is followed by five variable fields:
See "The Image Description Structure" beginning on page 3-43 for details on the
- The matte image description, which contains the image description structure for the matte. The variable size is specified in the first long integer in the opcode. This field is not included if the
MatteSize
field is 0.- The matte data, which contains the compressed data for the matte. The size of this field is defined by the
MatteSize
field described in Table 3-1. This field is not included if theMatteSize
field is 0.- The mask region, which contains the region for masking. The size of this variable is defined by the
MaskSize
field described in Table 3-1. This field is not included if theMaskSize
field is 0.- The image description structure for this data. The size of this variable is specified
in the first long integer in theidSize
field of this image description.- The image data, which contains the compressed data for the image. The size of the image data is specified in the image description's
dataSize
field.
idSize
anddataSize
fields.Table 3-2 provides an overview of the structure of uncompressed QuickTime images.
The
MatteRect
field of opcode $8201 is followed by three variable fields and a subopcode:
- The matte image description, which contains the image description structure for the matte. The size of this variable is specified in the first long integer in this opcode. This field is not included if the
MatteSize
field is 0.- The matte data, which contains information for the matte. The size of this variable is defined by the
MatteSize
field.- A subopcode (2 bytes in length) which describes the image and mask and is entirely within the other opcode. Its size is included in the size for the main opcode; hence it is not included if the QuickTime opcode is skipped. This subopcode can be either $98, $99, $9A, or $9B.
- The data for the subopcode variable which contains information for the image.